<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-type" content="text/html; charset=utf-8">
		<title>jQuery datePicker custom multi month example 2</title>

        <!-- jQuery -->
		<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
        
        <!-- required plugins -->
		<script type="text/javascript" src="scripts/date.js"></script>
		<!--[if IE]><script type="text/javascript" src="scripts/jquery.bgiframe.min.js"></script><![endif]-->
        
        <!-- jquery.datePicker.js -->
		<script type="text/javascript" src="scripts/jquery.datePicker.js"></script>
        
        <!-- datePicker required styles -->
		<link rel="stylesheet" type="text/css" media="screen" href="styles/datePicker.css">
		
        <!-- page specific styles -->
		<link rel="stylesheet" type="text/css" media="screen" href="styles/demo.css">
        
        <!-- page specific scripts -->
		<script type="text/javascript" charset="utf-8">
            $(function()
            {
				// create the left hand datePicker and add the relevant event listeners to sync it to the right hand one...
				$.fn.datePicker.defaults.inline = true;
				$.fn.datePicker.defaults.selectMultiple = true;

				$date1 = $('<div />')
					.datePicker()
					.bind(
						'dpMonthChanged',
						function(event, displayedMonth, displayedYear)
						{
							$date2.dpSetDisplayedMonth(displayedMonth+1, displayedYear);
						}
					)
					.bind(
						'dateSelected',
						function(event, date, $td, status)
						{
							$date2.dpSetSelected(date.asString(), status, false);
						}
					);
				// remove the "forward" navigation from the first date picker
				$('.dp-nav-next', $date1).html('');
				// create the right hand datePicker and add the relevant event listeners to sync it to the left hand one...
				$date2 = $('<div />')
					.datePicker()
					.bind(
						'dpMonthChanged',
						function(event, displayedMonth, displayedYear)
						{
							$date1.dpSetDisplayedMonth(displayedMonth-1, displayedYear);
							$date3.dpSetDisplayedMonth(displayedMonth+1, displayedYear);
						}
					)
					.bind(
						'dateSelected',
						function(event, date, $td, status)
						{
							$date1.dpSetSelected(date.asString(), status, false);
							$date3.dpSetSelected(date.asString(), status, false);
						}
					);
				// remove the "backward" navigation from the first date picker
				$('.dp-nav-prev, .dp-nav-next', $date2).html('');
				// create the right hand datePicker and add the relevant event listeners to sync it to the left hand one...
				$date3 = $('<div />')
					.datePicker()
					.bind(
						'dpMonthChanged',
						function(event, displayedMonth, displayedYear)
						{
							$date2.dpSetDisplayedMonth(displayedMonth-1, displayedYear);
						}
					)
					.bind(
						'dateSelected',
						function(event, date, $td, status)
						{
							$date2.dpSetSelected(date.asString(), status, false);
						}
					);
				// remove the "backward" navigation from the first date picker
				$('.dp-nav-prev', $date3).html('');
				// initialise the date pickers to consecutive months ($date1 defaults to this month so set $date2 to next month)
				var now = new Date();
				$date2.dpSetDisplayedMonth(now.getMonth()+1, now.getFullYear());
				$date2.dpSetDisplayedMonth(now.getMonth()+2, now.getFullYear());
				// add the generated combined plugin to the document
				$('#multimonth').html('').append($date1, $date2, $date3);
            });
		</script>

		<style type="text/css">
		#multimonth {
			border: 2px solid #000;
			overflow: auto;
			float: left;
		}
		.dp-applied {
			float: left;
		}
		table.jCalendar {
			border: none;
		}
		.dp-popup-inline {
			height: 160px;
		}
		</style>
		
	</head>
	<body>
        <div id="container">
            <h1>jquery.datePicker multi month example: showing how you can create a custom "multi month" date picker which shows two consecutive months</h1>
			<p><a href="index.html">&lt; date picker home</a></p>
			<p><strong>Deprecated:</strong> see the <a href="scripts/datePickerMultiMonth3.html">jquery.datePickerMultiMonth.js</a> plugin plugin!</p>
            <p>
                The following example displays how you can create a "multi month" date picker which shows two consecutive months and allows you to pick one
				date with them. It also shows how flexible the plugin is as this is achieved without modifying the plugin code at all and is instead implemented
				in the context of the page where it is necessary (which means it can be easily customised to behave exactly as you require in a given situation).
            </p>
			<form name="chooseDateForm" id="chooseDateForm" action="#">
				<div id="multimonth">This will be replaced with the multimonth select</div>
			</form>
			<p style="clear: left">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec turpis nisi, hendrerit et, mattis sit amet, tincidunt vel, nisi. Nullam hendrerit. Mauris dictum dictum neque. Nullam nisi eros, consectetur in, consectetur id, venenatis vel, turpis. Morbi porta scelerisque dui. Vivamus cursus odio at leo porttitor tincidunt. Nullam dolor mi, facilisis eget, fermentum nec, faucibus sed, ante. Aliquam nec libero. Integer nulla metus, lobortis eget, mattis eu, facilisis non, magna. Pellentesque ac sem cursus tortor tempor vehicula.</p>
			<p>Fusce neque. Donec erat magna, rhoncus in, vehicula eget, facilisis sit amet, erat. Integer leo nibh, pharetra ut, aliquam eu, condimentum et, lorem. Nulla ante. Nunc ut magna. Phasellus viverra ornare ante. Sed lacinia velit ut turpis. Suspendisse a purus. Fusce nec sapien. Vivamus vitae lorem vitae lacus congue pulvinar. In vulputate justo vitae est. Pellentesque consectetur, dui ac semper dignissim, ligula nibh gravida libero, hendrerit pretium metus nisl eu diam. Donec tellus arcu, commodo sit amet, lacinia eu, luctus quis, augue. In dui. Mauris id erat. Suspendisse libero lorem, luctus at, vestibulum et, pharetra et, tortor. Aliquam semper tempor lorem. Vestibulum libero augue, vehicula faucibus, porttitor sit amet, tempus non, ante.</p>
        </div>
	</body>
</html>